<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>二插搜索树</title>
	</head>
	<body>
		<!--
			二叉树的基本概念 
    1. 每一个根节点最多有2个子节点
		2. 父节点的左边子节点的数值小于父节点，父节点的右边子节点的数值大于父节点
    3. 最大的节点个数 2^(n-1) 
		4. k层的自多子节点的个数 2^(k) -1 个
		 -->

		<script src="index.js"></script>
		<script>
			let binarySearchTree = new BinarySearchTree()
			binarySearchTree.insert(11)
			binarySearchTree.insert(7)
			binarySearchTree.insert(15)
			binarySearchTree.insert(5)
			binarySearchTree.insert(3)
			binarySearchTree.insert(9)
			binarySearchTree.insert(8)
			binarySearchTree.insert(10)
			binarySearchTree.insert(13)
			binarySearchTree.insert(12)
			binarySearchTree.insert(14)
			binarySearchTree.insert(20)
			binarySearchTree.insert(18)
			binarySearchTree.insert(25)
			binarySearchTree.insert(6)
			// console.log(binarySearchTree.search(25))
			// console.log(binarySearchTree.min())
			// console.log(binarySearchTree.max())
			// console.log('先序遍历------------------------')
			// binarySearchTree.preOrderTraverse()
			// console.log('中序遍历------------------------')
			// binarySearchTree.inOrderTraverse()
			// console.log('后序遍历-----------------------')
			// binarySearchTree.postOrderTraverserch()
			// console.log('层序遍历遍历-----------------------')
			// let res = ''
			// binarySearchTree.leveltraversal(function hadel(v) {
			// 	res += v + ' '
			// })
			// console.log(res)
			// console.log(binarySearchTree.remove(7))
			// binarySearchTree.inOrderTraverse()
		</script>
	</body>
</html>
